#ifndef LASERCAMERAINSTRUCTIONLOGIC_H
#define LASERCAMERAINSTRUCTIONLOGIC_H

#include "motioninstruction.h"
#include "programset.h"
#include "instructionEnum.h"
#include "robotio.h"
#include "mccontrollerthread.h"
#include "axismoveinstruction.h"
#include "fleetdefine.h"
#include "lasercamerapointfetchinstruction.h"

class ProgramEngine;

class LaserCameraInstructionLogic
{
public:
    LaserCameraInstructionLogic(int robotIdIn, ProgramSet* programSetIn, RobotIo* ioControllerIn,
                                ProgramEngine* programEngineIn, McControllerThread *programMcControllerIn
                                , RegData *regDataIn);
    bool getLaserCameraTrackStatus();
    int reset();
    E_PROGRAM_LOOP_RESULT startFetchWeldPoint(int programNum, int startLine
                                              ,const LaserCameraPointFetchInstruction &instruction);
    E_PROGRAM_LOOP_RESULT startLaserCameraControl(int programNum, int startLine,const LaserCameraCtrlInstruction &ctrlInstruction);
    E_PROGRAM_LOOP_RESULT startLaserCameraTrack(int programNum, int startLine,const LaserCameraTrackInstruction &trackInstruction);
    E_PROGRAM_LOOP_RESULT fetchWeldPoint(PointPro &tcpPositionOut,int waitCountIn);
    E_PROGRAM_LOOP_RESULT laserScanStart(int programNum,bool isStartIn);

private:

    void realTimeSleep(long long umicoroSecond);
    void addMsg( int messageLevel,
                 std::string componentName,
                 std::string messageType,
                 int messageCode,
                 int robotId,
                 int parameter1 = 0,
                 int parameter2 = 0,
                 int parameter3 = 0,
                 int parameter4 = 0,
                 QString message= "");

private:
    int robotId;
    ProgramSet* programSet;
    RobotIo* ioController;
    ProgramEngine* programEngine;

    /**
     * @brief programMcController       算法线程指针
     */
    McControllerThread *programMcController;
    RegData *regData;
    bool isInLaserCameraTrack;

};

#endif // LASERCAMERAINSTRUCTIONLOGIC_H
